<template>
    <div class="errorpage" id="bgstar" ref="bgstar">
        404
        <div style="color:#f50" @click="changecount">{{count}}</div>
    </div>
</template>


<script>
import {ref,reactive,toRefs,onMounted,onUnmounted} from "vue"
export default {
    name:'404',
    setup(props,context){
        const bgstar =ref() //绑定ref
        const state =reactive({ //绑定响应式数据
            count:200
        })
        onMounted(()=>{
          console.log('组件初始化')  
        })
        onUnmounted(()=>{
            console.log('onUnmounted--组件销毁')
        })
        const changecount=()=>{
            state.count++
        }
        return {
            ...toRefs(state),
            bgstar,
            changecount
        }
        
    }
}
</script>